

function light(now, next, delay) {
    console.log(now +'灯'+ next +' '+ delay + '后跳转')
        return new Promise((resolve) => {
            setTimeout(() => {
                resolve()
            },delay * 1000)
        })

    
}
async function golight() {
    await light('red', 'yellow', 2)
    await light('yellow', 'green', 3)
    await light('green', 'red', 4)
    await golight()
}
golight()